//
//  ViewController.m
//  工作测试
//
//  Created by 华夏安科 on 2018/10/15.
//  Copyright © 2018年 华夏安科. All rights reserved.
//

#import "ViewController.h"
#import "MainPlayViewController.h"
#import "AFNetworking.h"
@interface ViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic,strong)UICollectionView *collectionView;
@end

@implementation ViewController{
    AFHTTPSessionManager *manager;
}
-(void)netconfig{
    manager = [AFHTTPSessionManager manager];
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.requestSerializer.timeoutInterval = 15.f;
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
    [manager.requestSerializer setValue:@"d8d0ce655fcae92344ec61c278ecfb1" forHTTPHeaderField:@"token"];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    _collectionView.dataSource = self;
    _collectionView.delegate = self;
    _collectionView.alwaysBounceVertical = NO;
    _collectionView.showsVerticalScrollIndicator = NO;
    UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new];
//    layout.itemSize = CGSizeMake(<#CGFloat width#>, <#CGFloat height#>);
}
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];

}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self netconfig];
    [manager POST:@"http://180.76.115.140/mobile/live/index" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject
                                                            options:NSJSONReadingMutableContainers
                                                              error:nil];
        NSLog(@"%@",dic);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
//    [self presentViewController:[MainPlayViewController new] animated:YES completion:nil];
}

@end
